<?php
class Default_Model_DbTable_Spot extends Zend_Db_Table_Abstract
{
	protected $_name="hae_spot";
	protected $_primary="id";
	protected $_sequence=true;
	public function getspot($regionId,$lang,$page)
	{
		$select = $this->select();
		$select->from($this->_name,array('id','name_'.$lang.' AS name','desc_'.$lang.' AS des','image'));
		$select->where('regionId = '.$regionId);
		
		$itemsPerPage = 4;
		$spot = new Zend_Paginator_Adapter_DbSelect($select);
		$spots = new Zend_Paginator($spot);
		$spots->setCurrentPageNumber($page);
		$spots->setItemCountPerPage($itemsPerPage);
		return $spots;
	}
	public function getspotId($id,$lang){
		$select = $this->select();
		$select->from($this->_name,array('id','name_'.$lang.' AS name','desc_'.$lang.' AS des','image'));
		$select->where('id = '.$id);
		return $this->fetchRow($select)->toArray();
	}
}
?>